VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "comdlg32.ocx"
Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.3#0"; "COMCTL32.OCX"
Begin VB.Form frmCreateIso 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Form1"
   ClientHeight    =   6675
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   9450
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   6675
   ScaleWidth      =   9450
   StartUpPosition =   1  'CenterOwner
   Begin ComctlLib.ProgressBar progBar 
      Height          =   255
      Left            =   3360
      TabIndex        =   19
      Top             =   6000
      Width           =   3015
      _ExtentX        =   5318
      _ExtentY        =   450
      _Version        =   327682
      Appearance      =   1
   End
   Begin VB.CommandButton cmdClear 
      Caption         =   "Clea&r ISO image"
      Height          =   375
      Left            =   6480
      TabIndex        =   20
      Top             =   5280
      Width           =   2775
   End
   Begin ComctlLib.StatusBar stat 
      Align           =   2  'Align Bottom
      Height          =   315
      Left            =   0
      TabIndex        =   18
      Top             =   6360
      Width           =   9450
      _ExtentX        =   16669
      _ExtentY        =   556
      SimpleText      =   ""
      _Version        =   327682
      BeginProperty Panels {0713E89E-850A-101B-AFC0-4210102A8DA7} 
         NumPanels       =   4
         BeginProperty Panel1 {0713E89F-850A-101B-AFC0-4210102A8DA7} 
            Text            =   "Image size:"
            TextSave        =   "Image size:"
            Key             =   ""
            Object.Tag             =   ""
         EndProperty
         BeginProperty Panel2 {0713E89F-850A-101B-AFC0-4210102A8DA7} 
            Text            =   "Overhead size:"
            TextSave        =   "Overhead size:"
            Key             =   ""
            Object.Tag             =   ""
         EndProperty
         BeginProperty Panel3 {0713E89F-850A-101B-AFC0-4210102A8DA7} 
            Text            =   "Directories:"
            TextSave        =   "Directories:"
            Key             =   ""
            Object.Tag             =   ""
         EndProperty
         BeginProperty Panel4 {0713E89F-850A-101B-AFC0-4210102A8DA7} 
            Object.Width           =   3528
            MinWidth        =   3528
            Text            =   "Files:"
            TextSave        =   "Files:"
            Key             =   ""
            Object.Tag             =   ""
         EndProperty
      EndProperty
   End
   Begin VB.TextBox txtVolId 
      Height          =   285
      Left            =   960
      TabIndex        =   15
      Text            =   "NEW_CD"
      Top             =   4680
      Width           =   2055
   End
   Begin VB.PictureBox Picture1 
      BackColor       =   &H8000000C&
      BorderStyle     =   0  'None
      FillColor       =   &H8000000A&
      ForeColor       =   &H8000000A&
      Height          =   4095
      Left            =   4800
      ScaleHeight     =   4095
      ScaleWidth      =   135
      TabIndex        =   14
      Top             =   480
      Width           =   135
   End
   Begin VB.CheckBox chkWrite 
      Caption         =   "Write to Cd after creation"
      Height          =   255
      Left            =   3600
      TabIndex        =   13
      Top             =   5280
      Width           =   2175
   End
   Begin VB.CommandButton cmdCancel 
      Caption         =   "C&ancel"
      Height          =   375
      Left            =   7920
      TabIndex        =   12
      Top             =   5880
      Width           =   1335
   End
   Begin VB.CommandButton cmdCreate 
      Caption         =   "&Create ISO"
      Height          =   375
      Left            =   6480
      TabIndex        =   11
      Top             =   5880
      Width           =   1335
   End
   Begin VB.Frame Frame1 
      Caption         =   "Interchange format"
      Height          =   1095
      Left            =   120
      TabIndex        =   7
      Top             =   5160
      Width           =   3135
      Begin VB.OptionButton optJoliet 
         Caption         =   "Joliet (still not supported)"
         Height          =   255
         Left            =   120
         TabIndex        =   10
         Top             =   720
         Width           =   2895
      End
      Begin VB.OptionButton optLevel2 
         Caption         =   "ISO level 2 (filename max. 30 chars)"
         Height          =   255
         Left            =   120
         TabIndex        =   9
         Top             =   480
         Width           =   2895
      End
      Begin VB.OptionButton optLevel1 
         Caption         =   "ISO level 1 (filename 8.3)"
         Height          =   255
         Left            =   120
         TabIndex        =   8
         Top             =   240
         Width           =   2175
      End
   End
   Begin VB.CommandButton cmdDelete 
      Caption         =   "D&elete"
      Height          =   375
      Left            =   7920
      TabIndex        =   6
      Top             =   4800
      Width           =   1335
   End
   Begin VB.CommandButton cmdNewFolder 
      Caption         =   "&New folder"
      Height          =   375
      Left            =   6480
      TabIndex        =   4
      Top             =   4800
      Width           =   1335
   End
   Begin VB.CommandButton cmdAddDir 
      Caption         =   "Add &directory"
      Height          =   375
      Left            =   5040
      TabIndex        =   3
      Top             =   4800
      Width           =   1335
   End
   Begin VB.CommandButton cmdAddFile 
      Caption         =   "Add &file"
      Height          =   375
      Left            =   3600
      TabIndex        =   2
      Top             =   4800
      Width           =   1335
   End
   Begin ComctlLib.ListView lsvFiles 
      Height          =   4095
      Left            =   5160
      TabIndex        =   1
      Top             =   480
      Width           =   3975
      _ExtentX        =   7011
      _ExtentY        =   7223
      View            =   3
      LabelEdit       =   1
      LabelWrap       =   -1  'True
      HideSelection   =   -1  'True
      _Version        =   327682
      ForeColor       =   -2147483640
      BackColor       =   -2147483643
      BorderStyle     =   1
      Appearance      =   1
      NumItems        =   2
      BeginProperty ColumnHeader(1) {0713E8C7-850A-101B-AFC0-4210102A8DA7} 
         Key             =   ""
         Object.Tag             =   ""
         Text            =   "Name"
         Object.Width           =   7056
      EndProperty
      BeginProperty ColumnHeader(2) {0713E8C7-850A-101B-AFC0-4210102A8DA7} 
         SubItemIndex    =   1
         Key             =   ""
         Object.Tag             =   ""
         Text            =   "Size"
         Object.Width           =   2540
      EndProperty
   End
   Begin ComctlLib.TreeView trwDirs 
      Height          =   4095
      Left            =   360
      TabIndex        =   0
      Top             =   480
      Width           =   3615
      _ExtentX        =   6376
      _ExtentY        =   7223
      _Version        =   327682
      Indentation     =   529
      LabelEdit       =   1
      Style           =   7
      Appearance      =   1
   End
   Begin MSComDlg.CommonDialog dlgFile 
      Left            =   8760
      Top             =   4680
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   393216
   End
   Begin VB.Label Label2 
      Caption         =   "Path:"
      Height          =   255
      Left            =   120
      TabIndex        =   17
      Top             =   120
      Width           =   495
   End
   Begin VB.Label Label1 
      Caption         =   "Volume id:"
      Height          =   285
      Left            =   120
      TabIndex        =   16
      Top             =   4680
      Width           =   855
   End
   Begin VB.Image image1 
      Height          =   4095
      Left            =   4320
      Top             =   480
      Width           =   135
   End
   Begin VB.Label lblPath 
      BorderStyle     =   1  'Fixed Single
      Caption         =   "Label1"
      Height          =   255
      Left            =   600
      TabIndex        =   5
      Top             =   120
      Width           =   8655
   End
End
Attribute VB_Name = "frmCreateIso"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'******************************************************************
'* File name     : frmCreateIso.frm
'* Version       : 0.2.0
'* Last revision : 15/01/05
'* Purpose       : Interface to create iso image
'*******************************************************************

'Copyright (C) 2004  Michele Moccia

'This program is free software; you can redistribute it and/or modify
'it under the terms of the GNU General Public License as published by
'the Free Software Foundation; either version 2 of the License, or
'(at your option) any later version.
'
'This program is distributed in the hope that it will be useful,
'but WITHOUT ANY WARRANTY; without even the implied warranty of
'MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
'GNU General Public License for more details.
'
'You should have received a copy of the GNU General Public License
'along with this program; if not, write to the Free Software
'Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA


Option Explicit

Private iDirIcon As Long                'index for directory icon
Private iDirOpenIcon As Long            'index for opened directory icon
Private currNode As ComctlLib.Node      'current node object in the treeview
Private sCurrPath As String             'current path in cd filesystem
Private split As CSplitter              'windows splitter
Private sFocusOn As String              'name of control with input focus
Private WithEvents mx As MxCtl          'MoxCdBurn control
Attribute mx.VB_VarHelpID = -1
Private lImageSize As Long              'total image size
Private bImageCreation As Boolean       'current operation is image creation
Private m_bRecorder As Boolean          'there's an opened recorder
Private m_sIsoFileName As String        'image to write to cd after creation


Private Sub cmdAddDir_Click()

    Dim iNull As Integer, lpIDList As Long, lResult As Long
    Dim sPath As String, udtBI As BrowseInfo

    With udtBI
        'Set the owner window
        .hWndOwner = Me.hWnd
        'lstrcat appends the two strings and returns the memory address
        .lpszTitle = lstrcat("Add directory to image", "")
        'Return only if the user selected a directory
        .ulFlags = BIF_RETURNONLYFSDIRS
    End With

    lpIDList = SHBrowseForFolder(udtBI)
    If lpIDList Then
        sPath = String$(MAX_PATH, 0)
        SHGetPathFromIDList lpIDList, sPath
        CoTaskMemFree lpIDList
        iNull = InStr(sPath, vbNullChar)
        If iNull Then
            sPath = Left$(sPath, iNull - 1)
        End If
    End If
    
    'Adds directory to the image under current folder
    If sPath <> "" Then
        Call mx.AddWholeDirIsoImage(sPath, sCurrPath)
        trwDirs.Nodes.item(sCurrPath).Expanded = True
        'Updates image statistics
        Call SetStat
    End If

End Sub


Private Sub cmdAddFile_Click()
    'Select a file to add to the image
    dlgFile.DialogTitle = App.Title & " - Add file to ISO image"
    dlgFile.ShowOpen
    If dlgFile.FileName = "" Then Exit Sub
    'Add file to the image
    Call mx.AddFileIsoImage(dlgFile.FileName, sCurrPath)
    'Fill the listview enumerating all child of current path
    'and update statistics
    Call SetStat
    lsvFiles.ListItems.Clear
    Call mx.GetIsoChilds(sCurrPath)
End Sub


Private Sub cmdCancel_Click()
    Unload Me
End Sub

Private Sub cmdClear_Click()
    'Re-initilize the image
    Call mx.ClearIsoImage
    Call mx.InitIsoImage
    Call ClearTreeview
    Call lsvFiles.ListItems.Clear
    Call SetStat
End Sub

Private Sub cmdCreate_Click()

    Dim iLevel As eIsoLevel
    Dim iRet As Integer
    
    If mx.GetIsoImageDepth > 8 Then
        iRet = MsgBox("Warning! ISO9660 doesn't allow directories depth greater than eigth." & _
                      " Some system could not read properly the image. Continue anyway?", _
                      vbYesNo, App.Title)
        
        If iRet = vbNo Then Exit Sub
    End If
    
    'Get the ISO9660 interchange level
    If optLevel1.Value = True Then
        iLevel = lvLevel1
    Else
        iLevel = lvLevel2
    End If
    
    'Select target file (*.iso by default)
    dlgFile.Filter = "iso image (*.iso)|*.iso|all files (*.*)|*.*"
    dlgFile.DefaultExt = "iso"
    dlgFile.ShowSave
    If dlgFile.FileName = "" Then Exit Sub
    'Set volume identifier and create the image
    mx.VolumeId = txtVolId.Text
    lImageSize = mx.GetIsoImageSize(iLevel) - mx.GetIsoImageOverhead(iLevel)
    cmdAddDir.Enabled = False
    cmdAddFile.Enabled = False
    cmdClear.Enabled = False
    cmdCreate.Enabled = False
    cmdNewFolder.Enabled = False
    cmdCancel.Enabled = False
    cmdDelete.Enabled = False
    stat.Panels.Clear
    stat.Panels.Add
    stat.Panels(1).Width = Me.Width
    progBar.Visible = True
    m_sIsoFileName = dlgFile.FileName
    bImageCreation = True
    Call mx.CreateIsoImage(dlgFile.FileName, iLevel)
End Sub

Private Sub cmdDelete_Click()
    Dim nod As ComctlLib.Node
    Dim lItem As ComctlLib.ListItem
    
    'treeview case
    If sFocusOn = trwDirs.Name Then
        Set nod = trwDirs.SelectedItem
        If (nod Is Nothing) = False Then
            'can't delete root folder
            If nod.Key = "\" Then Exit Sub
            'first pass the control to previous or next or parent node
            If (nod.Previous Is Nothing) = False Then
                Call trwDirs_NodeClick(nod.Previous)
            ElseIf (nod.Next Is Nothing) = False Then
                Call trwDirs_NodeClick(nod.Next)
            Else
                Call trwDirs_NodeClick(nod.Parent)
            End If
            'remove directory from the image and from the treeview
            Call mx.RemoveItemIsoImage(nod.Key)
            Call trwDirs.Nodes.Remove(nod.Index)
        End If
    'listview case
    ElseIf sFocusOn = lsvFiles.Name Then
        Set lItem = lsvFiles.SelectedItem
        If (lItem Is Nothing) = False Then
            'remove file from the image and from the listview
            Call mx.RemoveItemIsoImage(lItem.Key)
            Call lsvFiles.ListItems.Remove(lItem.Index)
        End If
    End If
    
    'update statistics
    Call SetStat
End Sub

Private Sub Form_Load()

    Dim hSysImgList As Long     'system image list
        
    Me.Caption = App.Title & " - Create ISO image"
    'set the status bar
    stat.Panels(1).Width = (Me.Width / 100) * 30
    stat.Panels(2).Width = (Me.Width / 100) * 30
    stat.Panels(3).Width = (Me.Width / 100) * 22
    stat.Panels(4).Width = (Me.Width / 100) * 18
    
    progBar.Visible = False
    If Not m_bRecorder Then chkWrite.Enabled = False

    'get the system image list
    hSysImgList = GetSystemImageList(SHGFI_SMALLICON)
    'assign system image list to the controls
    Call SendMessage(trwDirs.hWnd, TVM_SETIMAGELIST, TVSIL_NORMAL, ByVal hSysImgList)
    Call SendMessage(lsvFiles.hWnd, LVM_SETIMAGELIST, LVSIL_SMALL, ByVal hSysImgList)
    'subclass controls to prevent image list removing from ocx
    Call SubClass(trwDirs.hWnd, AddressOf TVWndProc)
    Call SubClass(lsvFiles.hWnd, AddressOf LVWndProc)
    'initialize other controls
    Call ClearTreeview
    optLevel1.Value = True
    optJoliet.Enabled = False
    Set split = New CSplitter
    Call split.InitControls(trwDirs, lsvFiles, Me, image1, Picture1)
    'create an empty ISO9660 image
    mx.InitIsoImage
    Call SetStat
    
End Sub
Private Sub ClearTreeview()
    
    Dim iIcon As Integer
    
    'image must have at least root folder so treeview will
    'ever get at least one node
    trwDirs.Nodes.Clear
    Set currNode = trwDirs.Nodes.Add(, , , "NEW_CD")
    currNode.Key = "\"
    sCurrPath = currNode.Key
    lblPath.Caption = sCurrPath
    'get application defined icon for the root folder
    iIcon = GetIconIndex(App.Path & "\NEW_CD.ico", SHGFI_SMALLICON)
    Call TV_SetItemImage(currNode, iIcon, iIcon)

End Sub


Private Function GetSystemImageList(ByVal lImageSize As Long) As Long

    Dim sWinDir As String
    Dim lLen As Long
    Dim fileInfo As SHFILEINFO
    
    'we need a directory path to get his icon and the system image list,
    'assume that every system has at least windows directory
    sWinDir = String(MAX_PATH, Chr$(0))
    lLen = GetWindowsDirectory(sWinDir, MAX_PATH)
    sWinDir = Left(sWinDir, lLen)
    
    'get directory icon and the system image list
    GetSystemImageList = SHGetFileInfo(sWinDir, 0&, fileInfo, Len(fileInfo), _
                                       SHGFI_SYSICONINDEX Or lImageSize)
    iDirIcon = fileInfo.iIcon
    'get opened directory icon
    Call SHGetFileInfo(sWinDir, 0&, fileInfo, Len(fileInfo), _
                       SHGFI_SYSICONINDEX Or SHGFI_OPENICON Or lImageSize)
                       
    iDirOpenIcon = fileInfo.iIcon
                           
End Function

Private Function GetIconIndex(ByVal sFqFileName As String, ByVal uFlags As Integer) As Integer

    Dim fileInfo As SHFILEINFO
    'get icon index of specified file
    Call SHGetFileInfo(sFqFileName, 0&, fileInfo, Len(fileInfo), SHGFI_SYSICONINDEX Or uFlags)
    GetIconIndex = fileInfo.iIcon
    
End Function

Public Function GetDisplayName(ByVal sPath As String) As String
    Dim fileInfo As SHFILEINFO
    'get single file name from fully qualified path name
    If SHGetFileInfo(sPath, 0, fileInfo, Len(fileInfo), SHGFI_DISPLAYNAME) Then
        If InStr(fileInfo.szDisplayName, vbNullChar) Then
            GetDisplayName = Left$(fileInfo.szDisplayName, InStr(fileInfo.szDisplayName, vbNullChar) - 1)
        Else
            GetDisplayName = fileInfo.szDisplayName
        End If
    End If
End Function

Public Function GetTVItemFromNode(hwndTV As Long, nod As ComctlLib.Node) As Long
    Dim nod1 As ComctlLib.Node, nod2 As ComctlLib.Node
    Dim anSiblingPos() As Integer
    Dim iLevel As Integer
    Dim hItem As Long
    Dim i As Integer
    Dim iPos As Integer
        
    'retrieves the treeview item handle matching the node
    'the only handle we surely know is the root handle, so we
    'raise to it parent by parent storing every position from
    'first element on level and remembering the node level.
    Set nod1 = nod
        
    Do While (nod1 Is Nothing) = False
        iLevel = iLevel + 1
        ReDim Preserve anSiblingPos(iLevel)
        Set nod2 = nod1
        iPos = 0
        Do While (nod2 Is Nothing) = False
            iPos = iPos + 1
            Set nod2 = nod2.Previous
        Loop
        anSiblingPos(iLevel) = iPos
        Set nod1 = nod1.Parent
    Loop

    'get root handle
    hItem = SendMessage(hwndTV, TVM_GETNEXTITEM, ByVal TVGN_ROOT, 0)
    'now descend to node getting handle by handle till our node handle
    If hItem Then
        For i = iLevel To 1 Step -1
            iPos = anSiblingPos(i)
            Do While iPos > 1
              hItem = SendMessage(hwndTV, TVM_GETNEXTITEM, ByVal TVGN_NEXT, ByVal hItem)
              iPos = iPos - 1
            Loop
            If (i > 1) Then
                hItem = SendMessage(hwndTV, TVM_GETNEXTITEM, ByVal TVGN_CHILD, ByVal hItem)
            End If
        Next
        GetTVItemFromNode = hItem
    End If

End Function

Private Sub TV_AddItem(ByVal sDirName As String, ByVal sParent As String)
    Dim nod As ComctlLib.Node
    Dim sNewKey As String, slash As String
    
    'If an already existing name is added we go out. Error will
    'be handled in the LogicalError event
    On Error GoTo Out
    If sParent <> "\" Then slash = "\"
    sNewKey = sParent & slash & sDirName
    Set nod = trwDirs.Nodes.Add(sParent, tvwChild, sNewKey, sDirName)
    Call TV_SetItemImage(nod, iDirIcon, iDirOpenIcon)
    
Out:

End Sub


Private Sub LV_AddItem(ByVal sFileName As String, ByVal sFqSource As String, ByVal lSize As Long)
    Dim item As ComctlLib.ListItem
 
    Set item = lsvFiles.ListItems.Add(, , sFileName)
    item.SubItems(1) = Format(lSize / 1024, "##,##0") & " KB"
    item.Key = sCurrPath & "\" & sFileName
    Call LV_SetItemImage(item, sFqSource)
    
End Sub

Private Sub TV_SetItemImage(nod As ComctlLib.Node, ByVal iImage As Integer, ByVal iSelectedImage As Integer)
    
    Dim tvi As TVITEM

    tvi.mask = TVIF_SELECTEDIMAGE Or TVIF_IMAGE
    tvi.iImage = iImage
    tvi.iSelectedImage = iSelectedImage
    tvi.hItem = GetTVItemFromNode(trwDirs.hWnd, nod)
    Call SendMessage(trwDirs.hWnd, TVM_SETITEM, 0, tvi)

End Sub

Private Sub LV_SetItemImage(ByVal item As ComctlLib.ListItem, ByVal sFqSource As String)
    
    Dim lvi As LVITEM

    lvi.mask = LVIF_IMAGE
    lvi.iImage = GetIconIndex(sFqSource, SHGFI_SMALLICON)
    lvi.iItem = item.Index - 1
    lvi.iSubItem = 0
    Call SendMessage(lsvFiles.hWnd, LVM_SETITEM, 0, lvi)

End Sub

Private Sub cmdNewFolder_Click()
    
    Dim sNewFolder As String
    
    sNewFolder = InputBox("Insert new folder name for the image", App.Title & " - New folder")
    
    If sNewFolder <> "" Then
        Call mx.AddFolderIsoImage(sNewFolder, sCurrPath)
        Call SetStat
    End If
    
    trwDirs.Nodes.item(sCurrPath).Expanded = True
 
End Sub

Public Property Let MxControl(ByRef vNewValue As MxCtl)
    Set mx = vNewValue
End Property

Public Property Let bRecorder(ByVal vNewValue As Boolean)
    m_bRecorder = vNewValue
End Property

Public Property Get IsoFileName() As String
    IsoFileName = m_sIsoFileName
End Property

Private Sub Form_Unload(Cancel As Integer)

    Set split = Nothing
    mx.ClearIsoImage

End Sub

Private Sub mx_IsoChildGot(ByVal IsDir As Boolean, ByVal FileName As String, ByVal FqSource As String, ByVal Parent As String, ByVal Size As Long)
    If Not IsDir Then
        Call LV_AddItem(FileName, FqSource, Size)
    End If
End Sub

Private Sub mx_IsoCreationEnd()
    Dim iRet As Integer
    
    stat.Panels(1).Text = "Completed"
    progBar.Visible = False
    Call MsgBox("Iso image file created successfully", , App.Title)
    If chkWrite.Value = 1 Then
        If m_bRecorder Then
            iRet = MsgBox("Proceeding to write image to current cd recorder", _
                          vbYesNo, App.Title)
            If iRet = vbNo Then m_sIsoFileName = ""
        End If
    Else
        m_sIsoFileName = ""
    End If
    Unload Me
    
End Sub

Private Sub mx_IsoItemAdded(ByVal IsDir As Boolean, ByVal FileName As String, ByVal FqSource As String, ByVal Parent As String, ByVal Size As Long)
    If IsDir Then
        Call TV_AddItem(FileName, Parent)
    End If
End Sub

Private Sub mx_IsoItemWritten(ByVal FileName As String, ByVal FqSource As String, ByVal Parent As String, ByVal Size As Long)
    Static lWritten As Long
    
    stat.Panels(1).Text = "Writing " & FqSource & " at " & Parent
    lWritten = lWritten + Size
    progBar.Value = CInt(CSng(lWritten / lImageSize) * 100)
End Sub

Private Sub mx_LogicalError(ByVal ErrorId As MoxCdBurnLibCtl.eLogicalErr, ByVal ErrorString As String)
    Call ErrorAndExit
End Sub

Private Sub mx_SysError(ByVal ErrorId As Long, ByVal ErrorString As String)
    Call ErrorAndExit
End Sub

Private Sub ErrorAndExit()
    If bImageCreation Then
        MsgBox "An error occured during the image creation", vbCritical, App.Title
        m_sIsoFileName = ""
        Unload Me
    End If
End Sub


Private Sub trwDirs_GotFocus()
    sFocusOn = trwDirs.Name
End Sub

Private Sub lsvFiles_GotFocus()
    sFocusOn = lsvFiles.Name
End Sub

Private Sub txtVolId_Change()
    trwDirs.Nodes(1).Text = txtVolId.Text
End Sub
Private Sub trwDirs_NodeClick(ByVal Node As ComctlLib.Node)
    If Node.Index <> trwDirs.Nodes.item(sCurrPath).Index Then
        sCurrPath = Node.Key
        Node.Expanded = True
        lsvFiles.ListItems.Clear
        lblPath.Caption = sCurrPath
        Call mx.GetIsoChilds(sCurrPath)
    End If
End Sub

Private Sub SetStat()
    stat.Panels(1).Text = "Image size: " & Format(mx.GetIsoImageSize(lvLevel1) / 1024, "##,##0") & " KB"
    stat.Panels(2).Text = "ISO9660 overhead size: " & Format(mx.GetIsoImageOverhead(lvLevel1) / 1024, "##,##0") & " KB"
    stat.Panels(3).Text = "Directories: " & CStr(mx.GetIsoDirCount)
    stat.Panels(4).Text = "Files: " & CStr(mx.GetIsoFileCount)
End Sub

